/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function loadThreads() {
    sendAJAXRequest('../../src/Servlets/ThreadServlet.php', loadThreadsRecieve, 'id=1');
}

function loadThreadsRecieve(JsonObj) {
    // Pure Sex, building HTML table that works in Internet explorer, no use of tbody or tbag
    // We'll set styles in the CSS file, but for now
    var output = '<table border="1" style="width:100%;border:solid black 1px; border-collapse:collapse;">';
    output += '<tr>';
    output += '<th>';
    output += 'Thread Id';
    output += '</th>';
    output += '<th>';
    output += 'Thread Name';
    output += '</th>';
    output += '</tr>';

    for (var i = 0; i < JsonObj.length; i++) {
        output += '<tr>';
        output += '<td align="center">';
        output += JsonObj[i].ID;
        output += '</td>';
        output += '<td align="center">';
        output += JsonObj[i].THREAD_NAME;
        output += '</td>';
        output += '</tr>';
    }

    output += '</table>';
    document.getElementById("mainDiv").innerHTML = output;
}
